USE [SSB]
GO

CREATE SCHEMA SSBPubSub
GO

CREATE TABLE [SSBPubSub].[Exception_Record](
	[ROWID]					[int] IDENTITY(1,1) NOT NULL,
	[Message_body]			[xml]					NULL,
	[InDate]				[datetime]			NOT NULL DEFAULT ('getdate()'),
	[Conversation_handle]	[uniqueidentifier]		NULL,
	[ErrorInfo]				[varchar](2000)			NULL,
	[FromService]			[varchar](100)			NULL,
	[ToService]				[varchar](100)			NULL,
CONSTRAINT PK_Exception_Record PRIMARY KEY CLUSTERED 
(
	[ROWID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


CREATE TABLE [SSBPubSub].[Publications_Record](
	[Conversation_handle]	[uniqueidentifier]	NOT NULL,
	[Subject]				[varchar](50)			NULL,
	[FromService]			[varchar](100)			NULL,
	[ToService]				[varchar](100)			NULL,
	[Server]				[varchar](30)			NULL,
	[Action]				[char](8)				NULL,
	[Message_body]			[xml]					NULL,
	[InDate]				[datetime]				NULL DEFAULT ('getdate()'),
 CONSTRAINT [PK_Publications_Record] PRIMARY KEY CLUSTERED 
(
	[Conversation_handle] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


CREATE TABLE [SSBPubSub].[Send_Record](
	[ROWID]					[int] IDENTITY(1,1) NOT NULL,
	[Message_body]			[xml]					NULL,
	[InDate]				[datetime]			NOT NULL DEFAULT ('getdate()'),
	[Conversation_handle]	[uniqueidentifier]	NOT NULL,
CONSTRAINT PK_Send_Record PRIMARY KEY CLUSTERED 
(
	[ROWID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO


CREATE TABLE [SSBPubSub].[Subscriptions_Record](
	[Conversation_handle]	[uniqueidentifier]	NOT NULL,
	[Subject]				[varchar](50)			NULL,
	[FromService]			[varchar](100)			NULL,
	[ToService]				[varchar](100)			NULL,
	[Server]				[varchar](30)			NULL,
	[Action]				[char](8)				NULL,
	[Message_body]			[xml]					NULL,
	[InDate]				[datetime]				NULL DEFAULT ('getdate()'),
 CONSTRAINT [PK_Subscriptions_Record] PRIMARY KEY CLUSTERED 
(
	[Conversation_handle] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]
GO